/*
	function:验证码
	return:正确返回1，否则返回0
*/
int identifyCode(void)
{
	char array[100]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
	char a[5]="";
	char b[5]="";

	while(1)
	{
		//得到验证码
		srand(time(NULL));
		a[0] = array[rand()%26];
		a[1] = array[rand()%26+26];
		a[2] = array[rand()%10+52];
		a[3] = array[rand()%10+52];
		a[4] = '\0';

		printf("验证码:");
		printf("%s\n",a);
		printf("请输入验证码（Esc强制退回）：");
		scanf("%5s",b);
		while('\n'!=getchar());

		if(strcmp(a,b) != 0)
		{
			printf("验证码错误，请重新输入！\n");
			if(b[0]==27)
			{
				return 0;
			}
		}
		else
		{
			return 1;
		}
	}
}